﻿using PHMEE.Managers.BaseInfo.Vessels;
using PHMEE.ToolKits;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PHMEE
{
    /// <summary>
    /// 集装箱船
    /// </summary>
    public class Container : Vessel
    {
        protected Container()
        {

        }
        public Container(Guid id, Guid fleetId, string name, string nameen, string imo)
            : base(id, fleetId, name, nameen, imo)
        {

        }

        /// <summary>
        /// 集装箱容量
        /// </summary>
        [NotMapped]
        public int ContainerCapacity { get; set; }

        /// <summary>
        /// 集装箱类型
        /// </summary>
        [NotMapped]
        public string ContainerType { get; set; }

        /// <summary>
        /// 当前装载的集装箱数量
        /// </summary>
        [NotMapped]
        public int NumberOfContainers { get; set; }


        /// <summary>
        /// 起重机数量
        /// </summary>
        [NotMapped]
        public int NumberOfCranes { get; set; }


        /// <summary>
        /// 冷藏集装箱数量
        /// </summary>
        [NotMapped]
        public int ReeferCount { get; set; }

        public override void SerializeProperties(Dictionary<string, object> derivedPropertiesJson)
        {
            var properties = PHMEECoreHelper.GetDerivedProperties(this);
            this.DerivedPropertiesJson = derivedPropertiesJson.Where(item => properties.Keys.Any(p => string.Equals(p, item.Key, StringComparison.OrdinalIgnoreCase))).ToDictionary();
        }

        public override void DeserializeProperties()
        {
            PHMEECoreHelper.SetDerivedProperties(this, DerivedPropertiesJson);
        }

    }
}
